package com.wenhao.jd;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

/**
 * @author Wenhao Tong
 * @create 2021-08-21 19:22
 */
public class Main1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] up = new int[n];
        int[] down = new int[n];
        for (int i = 0;i < n;i++) {
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            up[i] = x + y;
            down[i] = x - y;
        }
        Map<Integer,Integer> upMap = new HashMap<>();
        Map<Integer,Integer> downMap = new HashMap<>();
        for (int i = 0;i < n;i++) {
            if (upMap.containsKey(up[i])) {
                upMap.put(up[i], upMap.get(up[i]) + 1);
            } else {
                upMap.put(up[i],1);
            }
            if (downMap.containsKey(down[i])) {
                downMap.put(down[i], downMap.get(down[i]) + 1);
            } else {
                downMap.put(down[i],1);
            }
        }
        int result = 0;
        for (Map.Entry<Integer,Integer> entry : upMap.entrySet()) {
            int temp = entry.getValue();
            result += temp * (temp - 1) / 2;
        }
        for (Map.Entry<Integer,Integer> entry : downMap.entrySet()) {
            int temp = entry.getValue();
            result += temp * (temp - 1) / 2;
        }
        System.out.println(result);
    }

}
